/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.beans.fiscal;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bone
 */
@Entity
@Table(name = "RETENCAO_ICMS_TRANSPORTE")
public class RetencaoIcmsTransporte implements Serializable {

    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @OneToOne
    private VeiculoTransporte id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "VALOR_SERVICO")
    private BigDecimal valorServico;
    @Column(name = "BASE_ICMS")
    private BigDecimal baseIcms;
    @Column(name = "ALIQUOTA")
    private BigDecimal aliquota;
    @Column(name = "VALOR")
    private BigDecimal valor;
    @Column(name = "CFOP")
    private String cfop;
    @Basic(optional = false)
    @Column(name = "COD_MUNICIPIO_FATO_GERADOR")
    private int codMunicipioFatoGerador;

    public RetencaoIcmsTransporte() {
    }

    public BigDecimal getValorServico() {
        return valorServico;
    }

    public void setValorServico(BigDecimal valorServico) {
        BigDecimal oldValorServico = this.valorServico;
        this.valorServico = valorServico;
        changeSupport.firePropertyChange("valorServico", oldValorServico, valorServico);
    }

    public BigDecimal getBaseIcms() {
        return baseIcms;
    }

    public void setBaseIcms(BigDecimal baseIcms) {
        BigDecimal oldBaseIcms = this.baseIcms;
        this.baseIcms = baseIcms;
        changeSupport.firePropertyChange("baseIcms", oldBaseIcms, baseIcms);
    }

    public BigDecimal getAliquota() {
        return aliquota;
    }

    public void setAliquota(BigDecimal aliquota) {
        BigDecimal oldAliquota = this.aliquota;
        this.aliquota = aliquota;
        changeSupport.firePropertyChange("aliquota", oldAliquota, aliquota);
    }

    public BigDecimal getValor() {
        return valor;
    }

    public void setValor(BigDecimal valor) {
        BigDecimal oldValor = this.valor;
        this.valor = valor;
        changeSupport.firePropertyChange("valor", oldValor, valor);
    }

    public String getCfop() {
        return cfop;
    }

    public void setCfop(String cfop) {
        String oldCfop = this.cfop;
        this.cfop = cfop;
        changeSupport.firePropertyChange("cfop", oldCfop, cfop);
    }

    public int getCodMunicipioFatoGerador() {
        return codMunicipioFatoGerador;
    }

    public void setCodMunicipioFatoGerador(int codMunicipioFatoGerador) {
        int oldCodMunicipioFatoGerador = this.codMunicipioFatoGerador;
        this.codMunicipioFatoGerador = codMunicipioFatoGerador;
        changeSupport.firePropertyChange("codMunicipioFatoGerador", oldCodMunicipioFatoGerador, codMunicipioFatoGerador);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id.getId() != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RetencaoIcmsTransporte)) {
            return false;
        }
        RetencaoIcmsTransporte other = (RetencaoIcmsTransporte) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Apagar.RetencaoIcmsTransporte[ id=" + id + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

    public VeiculoTransporte getId() {
        return id;
    }

    public void setId2(VeiculoTransporte id) {
        VeiculoTransporte oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }
}
